The present invention relates to image size converting apparatus and method for magnifying or reducing image data by an image processing apparatus or an image processing system such as a printer apparatus or the like and also relates to a recording medium in which an image size converting program has been recorded and which can be read by a computer. More particularly, the invention relates to image size converting apparatus and method for improving a jaggy of an oblique line or drop-out of a thin line occurring by a conversion algorithm of a nearest neighborhood method and also relates to a recording medium in which an image size converting program has been recorded and which can be read by a computer.
Hitherto, there are various methods of an algorithm for magnifying or reducing image data to the designated number of pixels. For example, a nearest neighborhood method and a projecting method are known. According to the nearest neighborhood method, a pixel is repeated in the row direction and the column direction in order to magnify to the designated number of pixels or pixels are thinned out in the row and column directions in order to reduce to the designated number of pixels. Now assuming that the number (n) in the row.multidot.column which is subjected to the thinning-out process at the time of reduction and the repeating process at the time of magnification by the nearest neighborhood method is set to n=0, 1, 2, . . . , N-1 (where, N is the number of pixels in each of the row.multidot.column of a target pixel) and the number in the row.multidot.column of an inherent original image is labeled as Pn, the following equation is obtained. EQU Pn=int{(the number of original rows or columns)/(the number of rows or columns after magnification or reduction).times.n} (1)
where, "int" denotes that the remainder derived by the division is omitted to thereby obtain an integer.
The magnification and reduction by the nearest neighborhood method will now be described as follows with reference to FIG. 1. In FIG. 1, when an original image 200 of (4.times.4) dots as the number of pixels in the vertical and horizontal directions is magnified to, for example, a magnification image 102 of (5.times.5) dots as the number of pixels in the vertical and horizontal directions, the following equation is obtained from the above equation (1). EQU Pn=int{(4/5).times.n}
From the above relational equation, Pn=0, 0, 1, 2, 3 are obtained as the number Pn in the row.multidot.column of the original image 200 for the number n=0, 1, 2, 3, 4 in the row.multidot.column of a magnification image 202. The 0th row and the 0th column of the original image 200 become the row and column which are repeated.
In FIG. 1, when the original image 200 of (4.times.4) dots is reduced to, for example, a reduction image 104 of (2.times.2) dots, the following equation is obtained from the equation (1). EQU Pn=int{(4/2).times.n}
From the relational equation, Pn=0, 2 is obtained as a number Pn in the row.multidot.column of the original image 200 for the number n=0, 1 in the row.multidot.column of a reduction image 204. The first row and the first column and the third row and the third column of an original image 100 are the rows and columns which are thinned out.
According to the projecting method, a pixel value of each pixel of the original image and a ratio of the area which is occupied by the original pixels at the time of magnification or reduction are integrated and the sum of the integration results is used as a pixel value of each pixel after the magnification or reduction. A case of converting the original image 200 of (4.times.4) dots into a magnification image 206 of (5.times.5) dots by the projecting method will now be described with reference to FIG. 2. It is now assumed that pixels of the original image 200 have values of P00 to P33 and the pixels of the magnification image 206 have values of E00 to E44. When considering the pixel values E00, E11, and E22 of the magnification image as an example, the ratios of the areas which are occupied by the original pixels at the time of magnification will be integrated as follows.
E00=P00 PA1 E11=P00.times.1/25+P01.times.3/25+P10.times.3/25+P11.times.9/25 PA1 E22=P11.times.4/25+P12.times.4/25+P21.times.4/25+P22.times.4/25 PA1 R00=P00.times.9/16+P01.times.3/16+P02.times.3/16+P11.times.1/16 PA1 R00=P00.times.1/4+P01.times.1/4+P02.times.1/4+P11.times.1/4 PA1 a conversion magnification designating step of designating a conversion magnification (K) for converting an original image having (P.times.Q) dots as a predetermined number of pixels in the vertical and horizontal directions to a target image of (M.times.N) dots as a different number of pixels in the vertical and horizontal directions; PA1 a resolution designating step of designating a resolution of the target image; PA1 a first magnification processing step of magnifying the original image to the target image; PA1 a second magnification processing step of magnifying the original image to a virtual image of I(M.times.N) dots as the number of pixels in the vertical and horizontal directions obtained by multiplying (M.times.N) dots as the number of pixels in the vertical and horizontal directions of the target image by an integer (I) of 2 or larger and, after that, averaging the pixels on a unit basis of (I.times.I) dots as the number of pixels in the vertical and horizontal directions which coincides with the multiple (I) with respect to the virtual image, thereby calculating each pixel value of the target image when the original image is magnified to the target image; PA1 a first reduction processing step of reducing the original image to the target image; PA1 a second reduction processing step of magnifying the original image to a virtual image of I(M.times.N) dots as the number of pixels in the vertical and horizontal directions obtained by multiplying (M.times.N) dots as the number of pixels in the vertical and horizontal directions of the target image by the integer (I) of 2 or larger, and after that, averaging the pixels on the unit basis of (I.times.I) dots as the number of pixels in the vertical and horizontal directions which coincides with the multiple (I) with respect to the virtual image, thereby calculating each pixel value of the target image when the original image is reduced to the target image; PA1 a third reduction processing step of magnifying the original image to a virtual image of 2I(M.times.N) dots as the number of pixels in the vertical and horizontal directions which is obtained by multiplying (M.times.N) dots as the number of pixels in the vertical and horizontal directions of the target image by the value which is twice as large as the integer (I) of 2 or larger, and after that, averaging the pixels on the unit basis of 2(I.times.I) dots as the number of pixels in the vertical and horizontal directions which coincides with the multiple (I.times.2) with respect to the virtual image, thereby calculating each pixel value of the target image when the original image is reduced to the target image; and PA1 a process discriminating step of selecting an optimum processing step among the first magnification processing step, the second magnification processing step, the first reduction processing step, the second reduction processing step, and the third reduction processing step on the basis of a conversion magnification, a resolution, and an image size and allowing the selected processing step to execute a converting process. PA1 a conversion magnification designating module for designating a conversion magnification (K) for converting an original image having (P.times.Q) dots as a predetermined number of pixels in the vertical and horizontal directions to a target image of (M.times.N) dots as a different number of pixels in the vertical and horizontal directions; PA1 a resolution designating module for designating a resolution of the target image; PA1 a first magnification processing module for magnifying the original image to the target image; PA1 a second magnification processing module for magnifying the original image to a virtual image of I(M.times.N) dots as the number of pixels in the vertical and horizontal directions obtained by multiplying (M.times.N) dots as the number of pixels in the vertical and horizontal directions of the target image by an integer (I) of 2 or larger and, after that, averaging the pixels on a unit basis of (I.times.I) dots as the number of pixels in the vertical and horizontal directions which coincides with the multiple (I) with respect to the virtual image, thereby calculating each pixel value of the target image when the original image is magnified to the target image; PA1 a first reduction processing module for reducing the original image to the target image; PA1 a second reduction processing module for magnifying the original image to a virtual image of I(M.times.N) dots as the number of pixels in the vertical and horizontal directions obtained by multiplying (M.times.N) dots as the number of pixels in the vertical and horizontal directions of the target image by the integer (I) of 2 or larger, and after that, averaging the pixels on the unit basis of (I.times.I) dots as the number of pixels in the vertical and horizontal directions which coincides with the multiple (I) with respect to the virtual image, thereby calculating each pixel value of the target image when the original image is reduced to the target image; PA1 a third reduction processing module for magnifying the original image to a virtual image of 2I(M.times.N) dots as the number of pixels in the vertical and horizontal directions which is obtained by multiplying (M.times.N) dots as the number of pixels in the vertical and horizontal directions of the target image by the value which is twice as large as the integer (I) of 2 or larger, and after that, averaging the pixels on the unit basis of 2(I.times.I) dots as the number of pixels in the vertical and horizontal directions which coincides with the multiple (I.times.2) with respect to the virtual image, thereby calculating each pixel value of the target image when the original image is reduced to the target image; and PA1 a process discriminating module for selecting an optimum processing module among the first magnification processing module, the second magnification processing module, the first reduction processing module, the second reduction processing module, and the third reduction processing module on the basis of a conversion magnification, a resolution, and an image size and allowing the selected processing module to execute a converting process. PA1 a conversion magnification designating step of designating a conversion magnification (K) for converting an original image having (P.times.Q) dots as a predetermined number of pixels in the vertical and horizontal directions to a target image having (M.times.N) dots as a different number of pixels in the vertical and horizontal directions; and PA1 a conversion processing step of magnifying the original image to a virtual image of I(M.times.N) dots as the number of pixels in the vertical and horizontal directions which is obtained by multiplying (M.times.N) dots as the number of pixels in the vertical and horizontal directions of the target image by an integer (I) of 2 or larger and, after that, averaging the pixels on a unit basis of (I.times.I) dots as the number of pixels in the vertical and horizontal directions which coincides with the multiple (I) with respect to the virtual image, thereby calculating each pixel value of the target image. PA1 a conversion magnification designating module for designating a conversion multiplication (K) for converting an original image having (P.times.Q) dots as a predetermined number of pixels in the vertical and horizontal directions to a target image having (M.times.N) dots as a different number of pixels in the vertical and horizontal directions; and PA1 a conversion processing module for magnifying the original image to a virtual image of I(M.times.N) dots as the number of pixels in the vertical and horizontal directions which is obtained by multiplying (M.times.N) dots of the target image as the number of pixels in the vertical and horizontal directions of the target image by the integer (I) of 2 or larger and, after that, averaging the pixels on a unit basis of (I.times.I) dots as the number of pixels in the vertical and horizontal directions which coincides with the multiple (I) with respect to the virtual image, thereby calculating each pixel value of the target image.
A case of converting the original image 200 of (4.times.4) dots into a reduction image 208 of (3.times.3) dots by the projecting method will be described. It is now assumed that pixels of the reduction image 208 have values of R00 to R22. When considering the pixel value R00 of the reduction image 208 as an example, a ratio of the area which is occupied by the original pixels at the time of reduction is integrated as follows.
It can be also approximated as follows in order to simplify the calculation.
Since the process of the magnification or reduction of the image by the nearest neighborhood method is simple, a processing time is short. If a resolution is low, however, when an oblique line is printed by a printer or the like, there is a problem that a jaggy (stairway portions) is conspicuous and a picture quality deteriorates. Since the thinning-out operation is performed at the time of reduction, there is also a problem that a drop-out occurs in a part of a thin line when it is printed. On the contrary, in the projecting method, although deterioration in picture quality by magnification or reduction is small, since the process is complicated, a processing time required to magnify or reduce an image is long, it takes a long time until the printing operation is started after printing was instructed to a printer, and there is a problem that the printing is troublesome.